var app = getApp();
Component({
    properties: {
        params : Object,
    },
    options : {
        addGlobalClass : true,
    },
    data:{
        isshow : false,
        arealist : {},
        columns : [],
        key : '',
        index : 0,
    },
    methods: {
    	show(){
    		this.setData({
    			isshow : true,
    		})
    	},
    	hide(){
    		this.setData({
    			isshow : false,
    		})
    	},
    	select(){
	        var self = this;
	        var postdata = {
	            op : 'searchaus',
	            key : self.data.key ? self.data.key : '',
	        };
	        if( postdata.key == '' ){
	            app.com.alert('请填写内容');
	            return false;
	        }

	        app.com.http('user_v1','POST',postdata,0,true,'','',function(res){
	            if (!res.data.errno && res.data ) {
	                self.setData({
	                	columns : res.data.data.list,
	                	isshow2 : true,
	                })
	            }else{
	                app.com.alert(res.data.message);
	            }
	        });
    	},
    	onChange(e){
    		this.data.index = e.detail.index
    	},
    	confirm(e){
    		var tar = {
    			value : [
                    this.data.columns[this.data.index].province,
                    this.data.columns[this.data.index].city,
                    '',
                    this.data.columns[this.data.index].pshort,
                    this.data.columns[this.data.index].code,
                ]
    		};
    		this.triggerEvent('select',tar);
    		this.setData({
    			isshow : false,
    			isshow2 : false,
    		})
    	},
    	oninput(e){
    		this.data.key = e.detail
    	},
    	cancel(){
    		this.setData({
    			isshow2 : false,
    		})
    	}
    }
})